package com.jingdianjichi.club.gateway.enums;

import lombok.Getter;

/**
 * ClassName:ResultCode
 * Package:IntelliJ IDEA
 * Description:
 *
 * @Author xiaoming
 * @Create 2025/2/16 14:32
 * @Version 1.0
 */
@Getter
public enum ResultCodeEnum {
    SUCCESS(200,"成功"),
    FAIL(500,"失败");

    public int code;
    public String desc;

    ResultCodeEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static ResultCodeEnum getByCode(int codeVal) {
        for(ResultCodeEnum resultCodeEnum : ResultCodeEnum.values()) {
            if(resultCodeEnum.code == codeVal) {
                return resultCodeEnum;
            }
        }
        return null;
    }
}
